export const setStore = (name, value) => {
    if (!name) return;
    if (typeof value !== 'string') {
        value = JSON.stringify(value)
    }
    window.localStorage.setItem(name, value);
}

export const getStore = (name) => {
    if (!name) return;
    return window.localStorage.getItem(name)
}

export const removeStore = (name) => {
    if (!name) return;
    window.localStorage.removeItem(name)
}

export const checkNum = (num) => {

}

export const inArr = (arr, index) => {
    if (arr instanceof Array) {
        if (arr.indexOf(index) < 0) {
            return false
        }
        return true
    }
}

//设置cookie
export const setCookie = (name,value,day) =>{
    var date = new Date();
    date.setDate(date.getDate() + day);
    document.cookie = name + '=' + value + ';expires='+ date;
};
//获取cookie
export const getCookie = (name) => {
    var reg = RegExp(name+'=([^;]+)');
    var arr = document.cookie.match(reg);
    if(arr){
      return arr[1];
    }else{
      return '';
    }
};
//删除cookie
export const delCookie = (name) => {
    setCookie(name,null,-1);
};

//export const location = 'http://47.104.8.66:8080/resource/upload'
// export const location = 'http://192.168.0.105:8080/resource/upload'
 export const location = 'http://www.hbzhiku.org.cn/api/resource/upload'
